With the development and popularization of information technology, the demands of enterprises or families for data storage continuously increase. As a kind of network storage devices for providing data storage and file share services, NAS (Network Attached Storage) devices are more widely applied. As compared with that a public network IP address may be allocated for a NAS when the NAS is deployed by an enterprise, a home user generally deploys a NAS in a home local area network. The NAS deployed at home has no public network IP address, i.e., a home gateway is used as a NAT (Network Address Translation) device and an internal network IP is only allocated to the NAS. If it is expected to directly access the NAS over the Internet, the NAT device must be traversed. According to different access features, NAT may be divided into the following four types.
1. Full Cone NAT
For full core NAT, all requests which are sent from the same internal network IP and port number will be mapped to the same external network IP and port number, and any one of external network hosts can send packets to this internal network host through this mapped external IP and port number. As illustrated in FIG. 1, address pairs of an external network mapped by a private network address pair {X, y} are all {A, b}, and all hosts such as W, P and S on the external network can access {X, y} in the private network through {A, b}.
2. Restricted Cone NAT
For restricted cone NAT, as well, all requests which are sent from the same internal network IP and port number will be mapped to the same external network IP and port number. Different from the full cone NAT, external network hosts can only send packets to internal network hosts which previously had already sent data packets thereto. As illustrated in FIG. 2, address pair of the external network mapped by a private network address pair {X, y} are {A, b}, and packets of an external network P can only access {X, y} in a private network through {A, b}. As long as private network address pair is {X, y}, the mapped address pair will not change during outward connection, i.e., is {A, b}. In other words, if P is not connected with {X, y}, the mapped addresses of other external networks connected with {X, y} are still {A, b}.
3. Port Restricted Cone NAT
Port restricted cone NAT is very similar to the restricted cone NAT, and the difference lies in that it includes a port number. As illustrated in FIG. 3, if an external network host with an IP address X and a port P wants to send a packet to an internal network host, it is required that this internal network host previously had sent a data packet to the external network host with the IP address X and the port P. Address pairs of the external network mapped by a private network address pair {X, y} are {A, b} (bound), and packets of external networks with an address {P, q} can access {X, y} in a private network through {A, b}.
4. Symmetric NAT
For symmetric NAT, all requests which are sent from the same internal network IP and port number to a specific destination IP and port number will be all mapped to the same IP and port number. If the same host sends packets to different destination addresses by using the same source address and port number, NAT will use different mappings. Besides, external network hosts which receive data can only oppositely send packets to the internal network host. As illustrated in FIG. 4, address pairs of the external network mapped by a private network address pair {X, y} are {A, b}, and a binding is {X, y}|{A, b}← →{P, q}, and then NAT only receives packets from {P, q} and forwards the packets to {X, y}. When a client requests for one different public network address and port, a port number {C, d} will be newly allocated. Symmetric NAT is more complex than the above-mentioned several types of NAT. Regardless of private network address pair or public network address pair, as long as one party changes, the mapped address certainly changes, too.
In view of the above-mentioned different types of NATs, in NAT traversing solutions of the related technology, two detection servers will be deployed according to requirements of definition of the above-mentioned types of NATs. Firstly the type of NAT is detected, and then different NAT traversing solutions are implemented according to the type of NAT. However, in the above-mentioned NAT traversing solutions, since two detection servers need to be deployed, the cost in accessing NAS is increased and the efficiency of accessing NAS is low.